package tw.com.diary.core;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import tw.com.diary.ae.com.DirayBussinessException;
import tw.com.diary.api.domain.SearchResultDTO;
import tw.com.diary.api.service.SearchResultService;
import tw.com.diary.dao.X0001DAO;
import tw.com.diary.db.domain.X0001;
import tw.com.diary.db.util.DBHelp;

public class SearchResultServiceImpl implements SearchResultService {

	@Override
	public void queryByText(SearchResultDTO dto, Context ct)
			throws DirayBussinessException {

		dto.getQueryText();

		DBHelp help = new DBHelp(ct);

		SQLiteDatabase con = help.getWritableDatabase();

		final X0001DAO dao = new X0001DAO(con);

		dto.setResults(dao.selectByContent(dto.getQueryText()));
		con.close();

	}

}
